$(function () {
    $("#dologin").click(function () {
        var uid = $("#uid").val();
        var pwd = $("#pwd").val();
        // alert(uid+"-----"+pwd);
        $.ajax({
            type:"post",
            url:"/login",
            data:{uid:uid,pwd:pwd},
            dataType: "json",
            success : function(data){
                 // alert("11111");
                if(data.result == "success"){
                    window.location.href="/index";
                    $("#logout").attr("display","inline");
                }else{
                    $("#loginSpan").html("<span style='color: red;font-size: 0.8em'> 用户名或密码错误</span>");
                }}
        });
    });
});

$(function () {
    $("#uid").mouseleave(function () {
        var uid = $("#uid").val();
        // alert(uid);
        $.ajax({
            type:"post",
            url:"/queryUid",
            data:{uid:uid},
            dataType:"json",
            success:function (data) {
                if(data.num >=1){
                    $("#uidSpan").html("<span style='color: green;font-size: 0.8em'> 用户名正确</span>");
                }else{
                    $("#uidSpan").html("<span style='color: red;font-size: 0.8em'> 用户名不存在</span>");
                }
            }
        })
    })
})






















